import type { Dayjs } from 'dayjs';

import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace StoreApi {
  /** 店铺信息 */
  export interface Store {
    id: number; // 主键
    code?: string; // 店铺编号
    name?: string; // 店铺名称
    category: number; // 经营类目
    phone: string; // 联系电话
    email: string; // 电子邮箱
    openDate: Dayjs | string; // 开店时间
    address: string; // 详细地址
    status?: number; // 店铺状态
  }
}

/** 查询店铺分页 */
export function getStorePage(params: PageParam) {
  return requestClient.get<PageResult<StoreApi.Store>>(
    '/reservation/store/page',
    { params },
  );
}

/** 查询店铺详情 */
export function getStore(id: number) {
  return requestClient.get<StoreApi.Store>(`/reservation/store/get?id=${id}`);
}

/** 新增店铺 */
export function createStore(data: StoreApi.Store) {
  return requestClient.post('/reservation/store/create', data);
}

/** 修改店铺 */
export function updateStore(data: StoreApi.Store) {
  return requestClient.put('/reservation/store/update', data);
}

/** 删除店铺 */
export function deleteStore(id: number) {
  return requestClient.delete(`/reservation/store/delete?id=${id}`);
}

/** 导出店铺 */
export function exportStore(params: any) {
  return requestClient.download('/reservation/store/export-excel', params);
}


